package br.com.medvagas.comum.util;

import javax.servlet.ServletContext;

import org.springframework.web.context.WebApplicationContext;

public class UtilSpring {

	public static Object getBean(String nomeBean) {
		WebApplicationContext c = (WebApplicationContext) 
				UtilJSF.getServletContext().getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
		return c.getBean(nomeBean);
	}
	
	public static Object getBean(ServletContext sc, String nomeBean) {
		WebApplicationContext c = (WebApplicationContext) 
				sc.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
		return c.getBean(nomeBean);
		
	}
	
}
